#include <iostream>//Shape.cpp
#include "Shape.h"

using namespace std;

Circle::Circle(double radius)
{
    a = radius;//  直接将初始化值给继承来的数据成员
}

double Circle::reArea()
{
    return 3.1415*a*a;
}

void Circle::showData()
{
    cout<<"The circle"<<endl;
    cout<<"radius: "<<a<<endl;
    cout<<"Area: "<<reArea()<<endl<<endl;
}

Ellipse::Ellipse(double a_radius,double b_radius)
{
    a = a_radius;
    b = b_radius;
}

double Ellipse::reArea()
{
    return 3.1415*a*b;
}

void Ellipse::showData()
{
    cout<<"The ellipse"<<endl;
    cout<<"long axis: "<<a<<"  ";
    cout<<"short axis: "<<b<<endl;
    cout<<"Area: "<<reArea()<<endl<<endl;
}

Rectangle::Rectangle(double width,double height)
{
    a = width;
    b = height;
}

double Rectangle::reArea()
{
    return a*b;
}

void Rectangle::showData()
{
    cout<<"The rectangle"<<endl;
    cout<<"width: "<<a<<"  ";
    cout<<"height: "<<b<<endl;
    cout<<"Area: "<<reArea()<<endl<<endl;
}

Triangle::Triangle(double bottom,double height)
{
    a = bottom;
    b = height;
}

double Triangle::reArea()
{
    return (a*b) / 2;
}

void Triangle::showData()
{
    cout<<"The triangle"<<endl;
    cout<<"bottom: "<<a<<"  ";
    cout<<"height: "<<b<<endl;
    cout<<"Area: "<<reArea()<<endl<<endl;
}

Ball::Ball(double radius)
{
    a = radius;
}

double Ball::reVolume()
{
    return (4.0 / 3.0)*3.1415*a*a*a;
}

void Ball::showData()
{
    cout<<"The Ball"<<endl;
    cout<<"radius: "<<a<<endl;
    cout<<"Volume: "<<reVolume()<<endl<<endl;
}

Cylinder::Cylinder(double radius,double height)
{
    a = radius;
    b = height;
}

double Cylinder::reVolume()
{
    return 3.1415*a*a*b;
}

void Cylinder::showData()
{
    cout<<"The cylinder"<<endl;
    cout<<"radius: "<<a<<"  ";
    cout<<"height: "<<b<<endl;
    cout<<"Volume: "<<reVolume()<<endl<<endl;
}

Cuboid::Cuboid(double length,double width,double height)
{
    a = length;
    b = width;
    c = height;
}

double Cuboid::reVolume()
{
    return a*b*c;
}

void Cuboid::showData()
{
    cout<<"The cuboid"<<endl;
    cout<<"length: "<<a<<"  ";
    cout<<"width: "<<b<<endl;
    cout<<"height: "<<c<<endl;
    cout<<"Volume: "<<reVolume()<<endl<<endl;
}
